﻿/*
命名规则：dft:default
*/
var svcaddr;
var cookienm_questionnaire_useranswer = 'zebuz.questionnaire.answers';
var cookienm_secondpast = 'zebuz.questionnaire.answers.secondpast';

//get querystring
function dft_get_qry(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.search);
    if (results == null)
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}

function dft_redirect(message, url, timeoutSecond) {
    document.write(message);
    window.setTimeout(function () {
        window.location.href = url;
    }, timeoutSecond * 1000);
}

$(function () {
    // 为之后的ajax设定默认值
    $.ajaxSetup({
        type: 'POST',
        mode: 'abort', //防止重复提交，abort前一个
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        error: function (response) {
            if (response.statusText != "abort") {
                debugger;
                alert("oops，发生错误咯。" + response.responseText);
            }
        }
    });

    $('#sidebar>div').click(function () {
        window.location.href = $(this).attr("url");
    });

});